package com.ds.service;

import com.ds.orm.mapper.RoleDao;
import com.ds.orm.model.Role;
import com.ds.core.base.BaseService;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Du
 * @since 2017-11-19
 */
@Service
public class RoleService extends BaseService<Role>{
	@Autowired
	private RoleDao roleDao;
	public Set<String> getRoleTypesByUserId(long userId){
		List<String> roleTypes=roleDao.getRoleTypesByUserId(userId);
		Set<String> result=new HashSet<>();
		if (roleTypes==null||roleTypes.size()==0) {
			return null;
		}
		for (String type : roleTypes) {
			result.add(type);
		}
		return result;
	}
}
